package com.bw.a1908.core.http.call;

import io.reactivex.Observer;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;

public abstract class CallObserver<T> implements Observer<DataBean<T>>, IObserver<T> {

    @Override
    public void onSubscribe(@NonNull Disposable d) {

    }

    @Override
    public void onNext(@NonNull DataBean<T> tDataBean) {
        //处理公共code
        switch (tDataBean.code) {
            default:
            case 0:
                success(tDataBean.data);
                break;
        }
    }


    @Override
    public void onError(@NonNull Throwable e) {
        fail(e.getMessage());
    }

    @Override
    public void onComplete() {

    }
}
